//
//  ViewController.m
//  demo1
//
//  Created by apple on 16/4/1.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ViewController.h"
#import "MyView.h"
#import "MsgModel.h"
@interface ViewController (){
    UIScrollView * scrollView;
    MyView * myView;
    UIView * dataPiker;
}
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    myView=[[MyView alloc]init];
    MsgModel * model=[[MsgModel alloc]init];
    model.address=@"杭州师范大学";
    model.motive=@"图书馆还书";
    model.date=@"2015.07.15 12:20:10";
    model.color=[UIColor redColor];
    myView.msgModelArray=@[model,model,model,model,model,model,model,model,model,model,model,model];
}
-(void)viewWillAppear:(BOOL)animated{
    scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    scrollView.backgroundColor=RGBACOLOR(240, 240, 240, 1);
    dataPiker=[[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, SP_W(60))];
    myView.frame=CGRectMake(0,SP_W(65), WIDTH, SP_W(60)*myView.msgModelArray.count+65);
    scrollView.contentSize=CGSizeMake(0, SP_W(60)*(myView.msgModelArray.count+2)+SP_W(30));
    [scrollView addSubview:dataPiker];
    [scrollView addSubview:myView];
    [self.view addSubview:scrollView];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
